import service from "./config/request";
import { IRole } from "./role";
import { ApiResponse } from "./type";

export interface IProfile {
  id: number;
  username: string;
  email: string;
  mobile: string;
  isSuper: boolean;
  status: boolean;
  avatar: string;
  description: string;
  roles: IRole[];
  roleIds?: number[]; // 修改用户时后端只需要接受id就可以
}

export interface IUserLoginData {
  username: string;
  password: string;
}

export interface ILoginResponseData {
  token: string;
}

export const login = (
  data: IUserLoginData
): Promise<ApiResponse<ILoginResponseData>> => {
  //
  // return service.post("/auth/login", data);
  console.log(data, service);
  return Promise.resolve({
    data: {
      token: "121212"
    },
    code: 0,
    message: "ok"
  });
};
